package com.nbsaas.boot.controller.system;

import com.nbsaas.boot.common.api.domain.config.*;
import com.nbsaas.boot.config.ext.apis.ConfigExtApi;
import com.nbsaas.boot.rest.response.ResponseObject;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

/**
*  对外控制器
*/
@RequiresAuthentication
@RestController
@RequestMapping("/config")
public class ConfigController {


    @Resource
    private ConfigExtApi configExtApi;

    @RequestMapping("/ocr")
    public ResponseObject<OcrConfig> ocr() {
        return configExtApi.info(OcrConfig.class);
    }

    @RequestMapping("/configOcr")
    public ResponseObject<OcrConfig> configOcr(OcrConfig config) {
        return configExtApi.configData(config);
    }


    @RequestMapping("/voice")
    public ResponseObject<VoiceConfig> voiceConfig() {
        return configExtApi.info(VoiceConfig.class);
    }

    @RequestMapping("/configVoice")
    public ResponseObject<VoiceConfig> configVoice(VoiceConfig config) {
        return configExtApi.configData(config);
    }

    @RequestMapping("/info")
    public ResponseObject<SiteConfig> info() {
        return configExtApi.info(SiteConfig.class);
    }

    @RequestMapping("/face")
    public ResponseObject<FaceConfig> faceInfo() {
        return configExtApi.info(FaceConfig.class);
    }

    @RequestMapping("/configFace")
    public ResponseObject<FaceConfig> configFace(FaceConfig faceConfig) {
        return configExtApi.configData(faceConfig);
    }

    @RequestMapping("/code")
    public ResponseObject<CodeInfo> codeInfo() {
        return configExtApi.info(CodeInfo.class);
    }
    @RequestMapping("/configCode")
    public ResponseObject<CodeInfo> configCode(CodeInfo codeInfo) {
        return configExtApi.configData(codeInfo);
    }

    @RequestMapping("/configData")
    public ResponseObject<SiteConfig> config(SiteConfig config) {
        return configExtApi.configData(config);
    }
}